package com.web.jq.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.web.jq.pojo.Information;
import com.web.jq.respone.Result;
import com.web.jq.service.InformationService;

import net.sf.json.JSONArray;
@Controller
public class InformationController {

	@Autowired
	private InformationService informationService;

	@CrossOrigin(allowCredentials = "true",allowedHeaders = "*")
	@ResponseBody
	@RequestMapping("/Information")
	public Object findInformation() {
		List<Information> information=informationService.findInformation();
		if (information!=null) {
			JSONArray jsonstr=JSONArray.fromObject(information);
			System.out.println(jsonstr);
			return Result.success(jsonstr);
		}
		else {
			return "失败";
		}
	}
}
